/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 **************************************************************************
 * MIFSS  - content storage system
 *
 *
 * @uthors: uros.kristan@gmail.com (Uro? Kristan ) Urosk.NET
 *         jernej.svigelj@gmail.com (Jernej ?vigelj)
 */
package net.monare.mifss.workers.interfaces;

import net.monare.mifss.configurations.pojo.ApiKey;
import net.monare.mifss.configurations.pojo.ContentPoolDef;
import net.monare.mifss.configurations.pojo.StorageDef;
import net.monare.mifss.configurations.pojo.StorageSetDef;
import net.monare.mifss.exceptions.ConfigurationHandlerException;

import java.util.List;

public interface ConfigurationHandler {

    /**
     * Initialize complete handler
     *
     * @throws ConfigurationHandlerException
     */
    public void initialize() throws ConfigurationHandlerException;

    /* List methods */

    public StorageDef getStorageDefinitionFromName(String storageName);

    public StorageSetDef getStorageSetDefinitionFromName(String storageSetName);

    public List<String> listStorageNames();

    public List<StorageDef> listStorageDefinitions();

    public List<String> listAvailableTransformations();

    public List<String> listStorageSetNames() throws ConfigurationHandlerException;

    public List<StorageSetDef> listStorageSets() throws ConfigurationHandlerException;

    public List<StorageDef> listStorageDefsForStorageSetDef(String storageSetName) throws ConfigurationHandlerException;

    /* Exists methods  methods */

    public boolean storageDefinitionExistsInStorageSetDefinition(String storageSetDefName, String storageDefName);

    public boolean storageDefinitionExists(String storageDefName);

    public boolean storageSetDefinitionExists(String storageSetDefName);


    /* Lock unlock methods */

    public boolean setLockToStorageSetDefinition(String storageSetName, boolean locked, String lockedBy) throws ConfigurationHandlerException;


    /* Add, Modify, Remove  storage SET definition */

    public boolean addStorageSetDefinition(StorageSetDef newStorageSetDef) throws ConfigurationHandlerException;

    public boolean modifyStorageSetDefinition(StorageSetDef newStorageSetDef) throws ConfigurationHandlerException;

    public boolean removeStorageSetDefinition(String storageSetName) throws ConfigurationHandlerException;

    public void moveStorageDefinitionToStorageSetDefinition(String storageSetName, String storageName) throws ConfigurationHandlerException;


    /* Add, Modify, Remove  storage definition */

    public boolean addStorageDefinitionToStorageSetDefinition(String storageSetName, StorageDef newStorage) throws ConfigurationHandlerException;

    public void modifyStorageDefinition(String storageSetName, StorageDef storage) throws ConfigurationHandlerException;

    public void removeStorageDefinition(String storageSetName, String storageDefName) throws ConfigurationHandlerException;

    /* Add, Modify, Remove  API KEY */

    public void addApiKeyToStorageDefinition(String storageDefName, ApiKey apiKey) throws ConfigurationHandlerException;

    public void modifyApiKey(String storageDefName, ApiKey apiKey) throws ConfigurationHandlerException;

    public void removeApiKey(String storageDefName, ApiKey apiKey) throws ConfigurationHandlerException;

    /* Add, Modify, Remove  Content Pools definition*/

    public void addContentPoolDefinition(String storageName, ContentPoolDef contentPoolDef) throws ConfigurationHandlerException;

    public void modifyContentPoolDefinition(String storageName, ContentPoolDef contentPoolDef) throws ConfigurationHandlerException;

    public void removeContentPoolDefinition(String storageName, ContentPoolDef contentPoolDef) throws ConfigurationHandlerException;

    public List<String> listAvailablePoolImplmentations();
}
